<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="strings.html" />
<link rel="prev" href="builtin.html" />
<link rel="parent" href="lib.html" />
<link rel="next" href="truth.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>3. Built-in Types </title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.4 built-in Constants"
  href="node8.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="Python library Reference"
  href="lib.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="3.1 truth Value Testing"
  href="truth.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="node8.html">2.4 Built-in Constants</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="lib.html">Python Library Reference</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="truth.html">3.1 Truth Value Testing</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h1><a name="SECTION005000000000000000000"></a><a name="types"></a>
<br>
3. Built-in Types 
</h1>

<p>
The following sections describe the standard types that are built into
the interpreter.
<span class="note"><b class="label">Note:</b>
Historically (until release 2.2), Python's built-in types have
differed from user-defined types because it was not possible to use
the built-in types as the basis for object-oriented inheritance.
This limitation does not exist any longer.</span>

<p>
The principal built-in types are numerics, sequences, mappings, files,
classes, instances and exceptions.
<a id='l2h-146' xml:id='l2h-146'></a>
<p>
Some operations are supported by several object types; in particular,
practically all objects can be compared, tested for truth value,
and converted to a string (with
the <tt class="function">repr()</tt> function or the slightly different
<tt class="function">str()</tt> function).  The latter
function is implicitly used when an object is written by the
<tt class="keyword">print</tt><a id='l2h-147' xml:id='l2h-147'></a> statement.
(Information on the <a class="ulink" href="../ref/print.html"
  ><tt class="keyword">print</tt> statement</a>
and other language statements can be found in the
<em class="citetitle"><a
 href="../ref/ref.html"
 title="Python Reference Manual"
 >Python Reference Manual</a></em> and the
<em class="citetitle"><a
 href="../tut/tut.html"
 title="Python Tutorial"
 >Python Tutorial</a></em>.)

<p>

<p><br /></p><hr class='online-navigation' />
<div class='online-navigation'>
<!--Table of Child-Links-->
<a name="CHILD_LINKS"><strong>Subsections</strong></a>

<ul class="ChildLinks">
<li><a href="truth.html">3.1 Truth Value Testing</a>
<li><a href="boolean.html">3.2 Boolean Operations --
	    <tt class="keyword">and</tt>, <tt class="keyword">or</tt>, <tt class="keyword">not</tt></a>
<li><a href="comparisons.html">3.3 Comparisons</a>
<li><a href="typesnumeric.html">3.4 Numeric Types --
	    <tt class="class">int</tt>, <tt class="class">float</tt>, <tt class="class">long</tt>, <tt class="class">complex</tt></a>
<ul>
<li><a href="bitstring-ops.html">3.4.1 Bit-string Operations on Integer Types</a>
</ul>
<li><a href="typeiter.html">3.5 Iterator Types</a>
<li><a href="typesseq.html">3.6 Sequence Types --
	    <tt class="class">str</tt>, <tt class="class">unicode</tt>, <tt class="class">list</tt>,
	    <tt class="class">tuple</tt>, <tt class="class">buffer</tt>, <tt class="class">xrange</tt></a>
<ul>
<li><a href="string-methods.html">3.6.1 String Methods</a>
<li><a href="typesseq-strings.html">3.6.2 String Formatting Operations</a>
<li><a href="typesseq-xrange.html">3.6.3 XRange Type</a>
<li><a href="typesseq-mutable.html">3.6.4 Mutable Sequence Types</a>
</ul>
<li><a href="types-set.html">3.7 Set Types --
	    <tt class="class">set</tt>, <tt class="class">frozenset</tt></a>
<li><a href="typesmapping.html">3.8 Mapping Types -- <tt class="class">dict</tt></a>
<li><a href="bltin-file-objects.html">3.9 File Objects</a>
<li><a href="typecontextmanager.html">3.10 Context Manager Types</a>
<li><a href="typesother.html">3.11 Other Built-in Types</a>
<ul>
<li><a href="typesmodules.html">3.11.1 Modules</a>
<li><a href="typesobjects.html">3.11.2 Classes and Class Instances</a>
<li><a href="typesfunctions.html">3.11.3 Functions</a>
<li><a href="typesmethods.html">3.11.4 Methods</a>
<li><a href="bltin-code-objects.html">3.11.5 Code Objects</a>
<li><a href="bltin-type-objects.html">3.11.6 Type Objects</a>
<li><a href="bltin-null-object.html">3.11.7 The Null Object</a>
<li><a href="bltin-ellipsis-object.html">3.11.8 The Ellipsis Object</a>
<li><a href="node34.html">3.11.9 Boolean Values</a>
<li><a href="typesinternal.html">3.11.10 Internal Objects</a>
</ul>
<li><a href="specialattrs.html">3.12 Special Attributes</a>
</ul>
<!--End of Table of Child-Links-->
</div>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.4 built-in Constants"
  href="node8.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="Python library Reference"
  href="lib.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="3.1 truth Value Testing"
  href="truth.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="node8.html">2.4 Built-in Constants</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="lib.html">Python Library Reference</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="truth.html">3.1 Truth Value Testing</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
